<div class="layui-side layui-bg-black">
	<div class="layui-side-scroll">
		<#include "/apps/service/include/left.html">
	</div>
</div>
<div class="layui-body">
	<div class="layui-side-scroll">
		<div class="row">
			<div class="col-lg-12">
				<h1 class="site-h1 ukefu-tab" style="border-top:1px solid #e6e6e6;height:26px;">
					<span class="ukefu-bt">
						<i class="layui-icon ukewo-btn" style="font-size:20px;"></i>
						<div class="ukefu-bt-text">
							<div class="ukefu-bt-text-title">
								访客留言
							</div>
						</div>
					</span>
					<div class="ukefu-tab-title">
						<ul class="tab-title">
							<li <#if !process?? || (process?? && process=='')>class="layui-this"</#if>><a href="/service/leavemsg/index.html">未处理<#if leaveMsgList?? && (!process?? || (process?? && process==''))>（${leaveMsgList.totalElements}）</#if></a></li>
							<li <#if process?? && process!=''>class="layui-this"</#if>><a href="/service/leavemsg/index.html?process=true">已处理<#if leaveMsgList?? && process?? && process!=''>（${leaveMsgList.totalElements}）</#if></a></li>
						</ul>
					</div>
					<#if !leaveMsg.process>
					<div class="ukefu-bt-text-content" style="position: absolute;right: 5px;top: 0px;padding-right:10px;">	
						<div class="layui-btn-group ukefu-btn-group">
						  	<a  href="javascript:void(0)" id="batprocess" data-toggle="tip" data-title="请确认是否处理选中的留言？" class="layui-btn layui-btn-sm" >
							  	批量处理
						  	</a>
						</div>
					</div>
					</#if>
				</h1>
				<table class="layui-table" lay-skin="line">
					<thead>
						<tr class="design-sortable-tr">
							<th>
								<input type="checkbox" id="all" onclick="$('.ids').prop('checked' , $(this).prop('checked'));"/>
							</th>
							<th>姓名</th>
							<th>电话</th>
							<th>邮件</th>
							<th>地址</th>
							<th>QQ</th>
							<th>内容</th>
							<th>留言时间</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody>
						<#if leaveMsgList?? && leaveMsgList.content??>
						<#list leaveMsgList.content as leaveMsg>
						<tr class="tdHasContorllor design-dropable-td">
							<td style="width:1%;">
								<input type="checkbox" class="ids" name="ids" value="${leaveMsg.id!''}"/>
							</td>
							<td class=" first_td_head">
								<a href="javascript:void(0)">
								${leaveMsg.name!''}
								</a>
							</td>
							<td>
								${leaveMsg.mobile!''}
							<td>${leaveMsg.email!''}</td>
							<td>${leaveMsg.address!''}</td>
							<td>${leaveMsg.qq!''}</td>
							<td>${leaveMsg.content!''}</td>
							
							</td>
							<td><#if leaveMsg.createtime??>${leaveMsg.createtime?string('yyyy-MM-dd HH:mm:ss')}</#if></td>
							<td>
								<#if !leaveMsg.process>
								<a href="/service/leavemsg/process.html?id=${leaveMsg.id!''}&p=${p}" data-toggle="tip" title="请确认是否处理留言？">
									<i class="layui-icon">&#xe66e;</i>处理
								</a>
								</#if>
								<a href="/service/leavemsg/delete.html?id=${leaveMsg.id!''}&p=${p}<#if process?? && process!=''>&process=true</#if>" data-toggle="tip" title="删除留言不可恢复,请确认是否删除留言？" style="color: red;">
									<i class="layui-icon">&#x1006;</i>删除
								</a>
							</td>
						</tr>
						</#list>
						<#else>
							<tr>
								<td colspan="20" style="height:400px;">
									<div class="ukefu-empty">
										<i class="layui-icon">&#xe63a;</i>
										<div style="">当前没有访客留言</div>
									</div>
								</td>
							</tr>
						</#if>
					</tbody>
				</table>

			</div>
		</div>
		<div class="row" style="padding:5px;">
			<div class="col-lg-12" id="page" style="text-align:center;"></div>
		</div>
	</div>
</div>
<script>
	$(document).ready(function(){
		
		$('#batprocess').click(function(){
			var ids = "";
			var num = 0 ;
			$('.ids').each(function(){
				if($(this).prop("checked")){
					if(ids!=""){
						ids += "&" ;
					}
					ids += "ids=" + $(this).val();
					num++;
				}
			});
			if(num>0){
				$('#batprocess').attr('href' , '/service/leavemsg/batprocess.html?p=${p!''}&<#if process?? && process!=''>process=true&</#if>'+ids)	;
			}else{
				top.layer.alert("请先选择需要处理的留言");
				$('#batprocess').attr("href" , "javascript:void(0)");
			}
			
			
		});
	});	
	layui.use('form', function(){
		var form = layui.form;
	});
	layui.use(['laypage', 'layer'], function(){
		  var laypage = layui.laypage
		  ,layer = layui.layer;
		  
		  laypage.render({
				elem: 'page'
				,pages: <#if leaveMsgList??>${leaveMsgList.totalPages}<#else>0</#if> //总页数
				,curr:<#if leaveMsgList??>${leaveMsgList.number+1}<#else>0</#if>
				,groups: 5 //连续显示分页数
				,jump:function(data , first){
					if(!first){
						location.href = "/service/leavemsg/index.html?<#if process?? && process!=''>process=true&</#if>p="+data.curr ;
					}
				}
		   });
		});
</script>
